#include<stdio.h>
int i=0;
void movedisc(unsigned n,char formneedle,char toneedle,char usingneedle);
int main(int argc, char const *argv[])
{
    unsigned n;
    printf("enter number:");
    scanf("%d",&n);
    printf("\tneedle:\ta\tb\tc\n");
    movedisc(n,'a','c','b');
    printf("\t Total:%d\n",i);
    return 0;
}
void movedisc(unsigned n,char formneedle,char toneedle,char usingneedle)
{
    if(n>0)
    {
        movedisc(n-1,formneedle,usingneedle,toneedle);
        ++i;
        switch (formneedle)
        {
        case 'a':switch (toneedle)
        {
        case 'b':printf("\t[%d]:\t%2d------->%2d\n",i,n,n);
            break;
            case 'c':
            printf("\t[%d]:\t\t%2d------->%2d\n",i,n,n);
            break;
        }
         break;
        case 'c':switch (toneedle)
        {
        case 'a':
        printf("\t[%d]:\t%2d<-------%2d\n",i,n,n);
            break;
        case 'b':
        printf("\t[%d]:\t\t%2d<-------%2d\n",i,n,n);
            break;
        }
            break;
        }
        movedisc(n-1,usingneedle,toneedle,formneedle);
    }
}
